package frist50;

public class T0011 {
    public int maxArea(int[] height) {
        int max=0;
        int left=0,right=height.length-1;
        while (left<right){
            int a=height[left];
            int b=height[right];
            int area=Math.min(a,b)*(right-left);
            max=Math.max(max,area);
            if (a<b){
                left++;
            }else {
                right--;
            }
        }
        return max;
    }
}
